package com.javaEE.tes.services;

import com.javaEE.tes.dao.StudentRepository;
import com.javaEE.tes.dao.TeacherRepository;
import com.javaEE.tes.dao.UserAccountRepository;
import com.javaEE.tes.entities.Student;
import com.javaEE.tes.entities.Teacher;
import com.javaEE.tes.entities.UserAccount;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class UserAccountService {
    @Autowired
    UserAccountRepository userAccountRepository;
    @Autowired
    TeacherRepository teacherRepository;
    @Autowired
    StudentRepository studentRepository;
    public UserAccount save(UserAccount userAccount){
        return userAccountRepository.save(userAccount);
    }
    public List<UserAccount> getAll(){
      return   userAccountRepository.findAll();

    }
   public UserAccount findUserName(String userName){
        return userAccountRepository.findUserName(userName);
   }
   public String findByPassByUserName(String userName){
        return userAccountRepository.findByPassByUserName(userName);
   }
    public String findByTeacherNum(String teacherNum){
        return teacherRepository.findByTeacherNum(teacherNum);
    }
    public String findByStudentNum(String studentNum){
        return studentRepository.findByStudentNum(studentNum);
    }

}
